<?php defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

/* JoomLeague League Management and Prediction Game for Joomla!
 * @version $Id: show_results_ranking_div.tpl.php 1203 2008-07-10 08:20:27Z julienv $
 * @package Joomleague
 * @copyright Copyright (C) 2007  JoomLeague
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see _joomleague_license.txt
 *  
 * Homepage: http://www.joomleague.de
 * Support: htt://www.joomleague.de/forum/
 * 
 * This file is part of JoomLeague.
 *  
 * JoomLeague is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * Please note that the GPL states that any headers in files and
 * Copyright notices as well as credits in headers, source files
 * and output (screens, prints, etc.) can not be removed.
 * You can extend them with your own credits, though...
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 *
 * The "GNU General Public License" (GPL) is available at
 * http://www.gnu.org/copyleft/gpl.html.
*/
$htmlHelper->loadJLCss();
?>
<div id="joomleague">
<a name="jl_top" id="jl_top"></a>
<!-- Header with Project Name-->
<?php 
if ($table_config['show_project_heading'] == "1" OR $overall_config['show_project_heading'] == "1") 
{ 
  ?>
  <div class="componentheading" <?php
    if ($table_config['show_print_button'] == "1" OR $overall_config['show_print_button'] == "1") {
      echo ' style="float:left;"';
    }
    ?>>
    <?php
    echo $htmlHelper->showTitle($joomleague, $overall_config['project_heading_type']); 
    ?>
  </div>
  <!-- Druckfunktion -->
  <?php 
  if ($table_config['show_print_button'] == "1" OR $overall_config['show_print_button'] == "1") 
  {
    $htmlHelper->PrintIcon( $row, $params, false, '' );
  }
  ?>
  <!-- Druckfunktion Ende -->
  <?php
} 
?>
<!-- Header END -->

<!-- section header e.g. ranking, results etc. -->
<table width="100%" class="contentpaneopen">
	<tr>
		<td class="contentheading">
    <?php 
    if ($round>0) 
    {
      if ($results_config['show_section_heading']==1) 
      {
        $title = _JL_RESULTS;
        //1 request for current round
        $htmlHelper->show_matchdays_title($title, $rounds[$round-1]->id, $results_config);
    	  if (defined('JL_SHOW_EDIT_ICON')) $htmlHelper->show_edit_icon($round, $jl_func);
    	}
    }    
    else {
    	//1 request for current round
    	if ($results_config['show_section_heading']==1) $htmlHelper->show_matchdays_title(_JL_PLAN." - ". $team->name, 0, $results_config);
    }
    ?>
    </td>
    <?php     
    // select navigation of matchdays for browsing mode START
    if ( isset($pageNav) && $results_config['show_matchday_dropdown']==1 ) {
      echo '<td align="right">'._JL_MATCHDAYS_SELECT.$pageNav.'</td>';
    }
    // select navigation of matchdays for browsing mode ENDS    
    ?>
  </tr>
</table>
<!-- section header e.g. ranking, results etc. END -->
<br />
<!-- content -->
<?php
foreach ( $divisions as $divid )
{
  $thisawayrank = (isset($awayRank[$divid])) ? $awayRank[$divid] : NULL;
  $thishomerank = (isset($homeRank[$divid])) ? $homeRank[$divid] : NULL;
  ?>
  <table width="96%" align="center" border="0" cellpadding="3" cellspacing="0" class="contentpaneopen">
  <?php
  // header
  if ($divid) 
  {
    ?>
      <tr>
        <td class="contentheading"><?php  $htmlHelper->show_ranking_division_title($divid); ?>
        </td>
      </tr>
    <?php
  }
  ?>
  <!-- Results START -->
  <tr><td>
  <table width="96%" align="center" border="0" cellpadding="3" cellspacing="0">
  	<?php
  		if ( isset($overall_config['results_below'])&&$overall_config['results_below']==1) 
  		  $results_config['results_below']=1;
  		
  		$htmlHelper->resultsColspan($results_config);
  		
  		if (count($matches) > 0) {
  		  $htmlHelper->show_matches($matches[$divid], $resultTeams, $results_config);
  		}
  	?>
  </table>
  </td></tr>
  <!-- Results END -->
  
  <!-- ranking START -->
  <tr><td>
  <div style="width:99%;height:auto;overflow:auto;text-align:center;" align="center">
  <table width="96%" align="center" border="0" cellpadding="3" cellspacing="0">
  <?php
  $htmlHelper->show_ranking_heading( $type, $table_config );
  $htmlHelper->show_ranking_entries( $current_ranking[$divid], $previous_ranking[$divid], 
    $thishomerank, $thisawayrank, $type, $table_config );
  ?>
  </table>
  </div>
  </td></tr>
  <!-- ranking END -->
  <?php
}
?>
</table>

<!-- colors legend START -->
<?php if ($table_config['show_colors_legend']==1){;?>
<br />
<table width="96%" align="center" cellpadding="3" cellspacing="0">
  <tr>
      <?php
       $htmlHelper->show_colors_legend($colors);
      ?>
  </tr>
</table>
<?php };?>
<!-- colors legend END -->

<!-- if available points manipulations with explanations START -->
<?php
if (strstr( $table_config['ordered_columns'], 'START' ) ) {
$htmlHelper->show_manipulations($resultTeams);
}
?>
<!-- if available points manipulations with explanations END -->

<!-- Print Button START -->
<?php if ($table_config['show_back_button'] > 0 OR $overall_config['show_back_button'] > 0) {;?>
<?php if ($table_config['show_back_button'] == "1" OR $overall_config['show_back_button'] == "1") echo '<div align="left">'; else echo '<div align="right">';?>
<?php
$params = new mosParameters( '' );
$params->def( 'back_button', true );
$params->def( 'popup', false );
mosHTML::BackButton( $params );
  echo "</div>";
};?>
<!-- Print Button END -->
</div>